package nonDynamicFields;

import javax.swing.JLabel;
import javax.swing.JPanel;

import Models.Addition;

import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class NonDynamicEntry extends JPanel{
	String title;
	String contents;
	
	Addition add;
	
	JLabel titleLbl;
	JLabel contentsLbl;
	
	/**
	 * Creates a NonDynmicEntry w/ the title initialized
	 * if this is to be used for an addition then the string is not needed
	 * @param title
	 */
	public NonDynamicEntry(String title) {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{0, 0, 0};
		gridBagLayout.rowHeights = new int[]{0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		titleLbl = new JLabel("");
		GridBagConstraints gbc_lblTitle = new GridBagConstraints();
		gbc_lblTitle.anchor = GridBagConstraints.WEST;
		gbc_lblTitle.weightx = 1;
		gbc_lblTitle.insets = new Insets(0, 0, 0, 5);
		gbc_lblTitle.gridx = 0;
		gbc_lblTitle.gridy = 0;
		add(titleLbl, gbc_lblTitle);
		
		contentsLbl = new JLabel("");
		GridBagConstraints gbc_lblContents = new GridBagConstraints();
		gbc_lblContents.anchor = GridBagConstraints.WEST;
		gbc_lblContents.weightx = 1;
		gbc_lblContents.gridx = 1;
		gbc_lblContents.gridy = 0;
		add(contentsLbl, gbc_lblContents);
		
		
	}
	

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the contents
	 */
	public String getContents() {
		return contents;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @param contents the contents to set
	 */
	public void setContents(String contents) {
		this.contents = contents;
	}
	
	public void setAddition(Addition add) {
		this.titleLbl.setVisible(false);  //we don't need the title for an addition
		//get addition type & display accordingly
	}

	
}
